package com.mnsq.common.bean.vo.category;

import com.mnsq.common.bean.annotation.JpaFields;
import com.mnsq.common.bean.condition.CommonBaseCondition;
import com.mnsq.common.bean.entity.category.Category;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author Administrator
 */
@Data
public class CategoryCondition extends CommonBaseCondition<Category> {
    @ApiModelProperty("分类编码")
    @JpaFields(attrType = JpaFields.AttrType.EQ)
    private String code;
    private String name;
    private Long typeId;
    private Long pId;
    @JpaFields(attrType = JpaFields.AttrType.EQ)
    private String str;
    private Integer level;
    private Integer status = 1;

    @Override
    public boolean isEmpty() {
        if (StringUtils.isNotBlank(code)) {
            return false;
        } else if (typeId == null) {
            return false;
        } else if (pId == null) {
            return false;
        } else if (StringUtils.isNotBlank(str)) {
            return false;
        } else if (level == null) {
            return false;
        }
        return true;
    }

    @ApiModelProperty(hidden = true)
    @Override
    public Category getInstance() {
        return new Category();
    }
}
